package february.test_2_1;

import java.util.Scanner;



public class TestMain2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[32];
        A(n,arr);
        int h = 0;
        int max = 0;
        int cur = -1;
        for (int i = 0; i < 32; i++) {
            h += arr[i];
            if(i - cur != h) {
                cur = i;
                max = Math.max(max,h);
                h = 0;
            }
        }
        System.out.println(max);
    }

    private static void A(int n ,int[] arr) {
        int tmp = 0;
        while (true) {
            int count = (int)Math.pow(2,tmp);
            if(n / count <= 0) {
                break;
            }
            tmp++;
        }
        int i = 0;
        for (tmp = tmp - 1;tmp >= 0; tmp --) {
            if(n >= Math.pow(2,tmp)) {
                n -= Math.pow(2,tmp);
                arr[i++] = 1;
            } else {
                arr[i++] = 0;
            }
        }
    }
}
